package com.cloud.consumer.ctrl;

import com.base.dto.Params;
import com.base.dto.Result;
import com.cloud.consumer.feign.DemoFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * Description:
 * Copyright: Copyright (c) 2023
 * Company: Ruijie Co., Ltd.
 * Create Time: 2024/7/20
 *
 * @author linke
 */
@RestController
@RequestMapping("consumer")
public class ConsumerController {

    @Autowired
    private DemoFeignService demoFeignService;

    @GetMapping("feign")
    public Result consumer() {
        Result r = demoFeignService.getProducer("rrrr");
        return new Result(0, r.getMessage());
    }

    @GetMapping("feignPost")
    public Result consumerPost() {
        Params params = new Params();
        params.setAge(11);
        params.setDate(new Date());
        params.setName("aaa");
        Result r = demoFeignService.post(params);
        return new Result(0, r.getMessage());
    }
}
